package oj;

//反转链表
public class Num024 {
    public ListNode reverseList(ListNode head) {
        //前驱节点
        ListNode prev = null;
        ListNode node = head;
        while(node != null){
            ListNode next = node.next;
            node.next = prev;
            prev = node;
            node = next;
        }
        return prev;
    }
}
